<%#
kind: snippet
name: pxegrub2_discovery
model: ProvisioningTemplate
snippet: true
description: |
  Snippet with grub2 menu items for discovery plugin. It is included in PXEGrub2 Default templates to boot unknown hosts into discovery image.

  RHEL 7 virtio driver does not have persistent naming scheme, causing interfaces
  to be named eth0, eth1, etc.. If you want to enable the new persistent naming
  scheme and get inteface names like ens3, add net.ifnames=1 to the linuxefi line
  below. This will not be fixed until RHEL8 due to prevent breaking changes for
  existing systems. See RHBZ#1259015 for more details.
-%>
common="rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nokaslr nomodeset proxy.url=<%= foreman_server_url %> proxy.type=foreman BOOTIF=01-$net_default_mac"

if [ ${grub_platform} == "pc" ]; then
  menuentry 'Foreman Discovery Image' --id discovery {
    linux boot/fdi-image/vmlinuz0 ${common}
    initrd boot/fdi-image/initrd0.img
  }
else
  menuentry 'Foreman Discovery Image EFI' --id discovery {
    linuxefi boot/fdi-image/vmlinuz0 ${common}
    initrdefi boot/fdi-image/initrd0.img
  }
fi
